]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
frequentView: Use BaseAppView.addItem() and loadGrid()
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sat, 29 Jun 2019 16:15:20 +0000 (13:15 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 6 Aug 2019 00:19:25 +0000 (21:19 -0300)
FrequentView is another view that is slightly not unified with how
BaseAppView expects subclasses to load app icons. Instead of using
BaseAppView.addItem() and then calling BaseAppview.loadGrid(), it
adds the app icons directly to the icon grid.

Make FrequentView add icons using BaseAppview.addItem(), and load
the icons using BaseAppView.loadGrid().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645

js/ui/appDisplay.js

index cbd13b3f64c533c2600ae8161ef07119a77be284..b1a2e5603b7afa2039cd22a172c4294837d58f50 100644 (file)
@@ -706,6 +706,11 @@ var FrequentView = class FrequentView extends BaseAppView {
         return this._usage.get_most_used().length >= MIN_FREQUENT_APPS_COUNT;
     }
 
+    _compareItems() {
+        // The FrequentView does not need to be sorted alphabetically
+        return 0;
+    }
+
     _loadApps() {
         let mostUsed = this._usage.get_most_used();
         let hasUsefulData = this.hasUsefulData();
@@ -726,8 +731,10 @@ var FrequentView = class FrequentView extends BaseAppView {
                 continue;
             let appIcon = new AppIcon(mostUsed[i],
                                       { isDraggable: favoritesWritable });
-            this._grid.addItem(appIcon, -1);
+            this.addItem(appIcon);
         }
+
+        this.loadGrid();
     }
 
     // Called before allocation to calculate dynamic spacing